package com.own.business.system.dictionary.common.handler;

import com.own.business.system.dictionary.common.exception.DictionaryException;
import com.own.component.common.model.ExceptionMessageModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * SystemDictionaryExceptionHandler
 *
 * @author chenxueli
 * @date 2023-06-21 09:34:02
 */
@Slf4j
@Order(1)
@RestControllerAdvice
public class SystemDictionaryExceptionHandler {

    @ExceptionHandler(DictionaryException.class)
    public ExceptionMessageModel handleSystemException(DictionaryException e) {
        log.error(e.getMessage());
        return new ExceptionMessageModel(e);
    }

}
